<?php
/**
 * @author 天涯 <mail@phpha.com>
 * @copyright http://blog.phpha.com
 * @link http://blog.phpha.com/vncms
 * @version 1.0
 */
defined('APP_PATH') or exit('Access Denied');
class m_table extends spModel{
	public $table = 'table';
	public $pk = 'modelid';
	//自动验证
	public $verifier = array(
		'rules'=>array(
			'modelname'=>array(
				'notnull'=>true,
			),
			'tablename'=>array(
				'notnull'=>true,
			),
		),
	);
	//检测表名
	public function check_table($table){
		$tables = array();
		$query = $this->findSql("SHOW TABLES");
		foreach($query as $v){
			foreach($v as $v2){
				$tables[] = $v2;
			}
		}
		return in_array($GLOBALS['G_SP']['db']['prefix'] . $table, $tables) ? 1 : 0;
	}
}
